// components/wolf/wolf.js
Component({
  properties: {

  },
  data: {
    isWolf: getApp().data.isWolf,
    focusTime: 0,
  },
  methods: {
    back() {
      console.log("实际上回不去，其实按底下的导航栏就行")
      wx.switchTab({
        url: 'pages/index/index',
      })
    },
    setFocusTime: function (e) {
      this.setData({
        focusTime: parseInt(e.detail.value) * 60 * 1000
      });
    },
    startFocus: function () {
      const that = this
      // 这里可以添加开始计时的逻辑  
      if (this.data.focusTime != 0) {
        getApp().showSuccess('专注时间开始！')
        setTimeout(() => {
          getApp().showSuccess('专注时间结束！')
        }, this.data.focusTime)
      } else {
        getApp().showError("请设定专注时长！")
      }
    },
  },
  lifetimes: {
    attached: async function () {
      await getApp().showWolf()
      this.setData({
        isWolf: getApp().data.isWolf
      })
    },
  }
})